# Maintainer: Martell Malone <martellmalone@gmail.com>

_realname=http-parser

pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")

pkgver=2.3
pkgrel=1
pkgdesc='Parser for HTTP Request/Response written in C (mingw-w64)'
arch=('any')
url='http://github.com/joyent/http-parser'
license=('MIT')


source=("http://github.com/joyent/http-parser/archive/v${pkgver}.tar.gz")
md5sums=('SKIP')
options=('strip')

prepare() {
  cd ${srcdir}/${_realname}-$pkgver

  if [[ $CARCH == x86_64 ]]; then
  msg 'removing -fPIC'
  sed -i 's/-fPIC//g' Makefile
  fi
}

build() {
  cd ${srcdir}/${_realname}-$pkgver
  make -j1 package
}


package() {
  cd ${srcdir}/${_realname}-$pkgver
  install -Dm644 http_parser.h "${pkgdir}/${MINGW_PREFIX}/include/http_parser.h"
  install -Dm644 libhttp_parser.a "${pkgdir}/${MINGW_PREFIX}/lib/libhttp_parser.a"
}
